//
//  TixianjiluVC.m
//  SSC
//
//  Created by 红沙尘 on 17/6/10.
//  Copyright © 2017年 红沙尘. All rights reserved.
//

#import "TixianjiluVC.h"
#import "ChongzhijiluCell.h"

@interface TixianjiluVC ()

@end

@implementation TixianjiluVC

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    return [super initWithNibName:NSStringFromClass([self.superclass class]) bundle:nibBundleOrNil];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"提现记录"];
}


- (void)loadData {
    [super loadData];
    
    WeakSelf
    __weak UITableView *weakTableView = mainTableView;
    
    [SSCRequest applyAmountLogsStartdt:[MTool formartDate:startField.text]
                                 enddt:[MTool formartDate:endField.text]
                                  page:page
                               success:^(NSDictionary *responseObject)
     {
         [weakTableView.mj_header endRefreshing];
         [weakTableView.mj_footer endRefreshing];

         [weakSelf loadWithArray:[NSString safeArray:responseObject[@"data"]]];

     } fail:^(NSError *error) {
         [weakTableView.mj_header endRefreshing];
         [weakTableView.mj_footer endRefreshing];
     }];
}


#pragma mark - table

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ChongzhijiluCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChongzhijiluCell"];
    
    [cell loadTixianDict:dataArray[indexPath.row]];
    
    return cell;
}

- (void)setupUI {
    [super setupUI];
        
    mainTableView.rowHeight = 128;
    mainTableView.estimatedRowHeight = 128;
    
    [mainTableView registerNib:[UINib nibWithNibName:@"ChongzhijiluCell" bundle:nil]
        forCellReuseIdentifier:@"ChongzhijiluCell"];
}

@end
